Skip to content

Conversation

@rxin
Copy link
Contributor

@rxin rxin commented Jul 19, 2015

This pull request fixes some of the problems in #6981.

  • Added date functions to __all__ so they get exposed
  • Rename day_of_month -> dayofmonth
  • Rename day_in_year -> dayofyear
  • Rename week_of_year -> weekofyear
  • Removed "day" from Scala/Python API since it is ambiguous. Only leaving the alias in SQL.

…stems.

This renames some of the functions that are just merged in order to be more consistent with other databases.

Also did some small cleanups.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this previously cut right into the middle of string functions so I moved them

@rxin
Copy link
Contributor Author

rxin commented Jul 19, 2015

cc @tarekauel and @davies

@davies
Copy link
Contributor

davies commented Jul 19, 2015

LGTM

@tarekbecker
Copy link
Contributor

@rxin Could you do this little fix as well?
https://github.com/apache/spark/pull/7505/files

Why do we switch from day_of_month to dayofmonth? Most SQL implementations use underscores:
MySQL SAP HANA Oracle
I would prefer underscores, because they improve the readability, if you write all SQL stuff in caps, like:
SELECT name, age, DAY_OF_MONTH(birthday) AS birthday FROM people WHERE age > 15 compared to SELECT name, age, DAYOFMONTH(birthday) AS birthday FROM people WHERE age > 15
I'm not a Python pro, but I thought that underscores are 'pythonic', aren't they?

@rxin
Copy link
Contributor Author

rxin commented Jul 19, 2015

Both MySQL and HANA use dayofmonth, without the underscore?

@SparkQA
Copy link

SparkQA commented Jul 19, 2015

Test build #37759 has finished for PR 7506 at commit e44a4a0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class Hour(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class Minute(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class Second(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class DayOfYear(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class Year(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class Quarter(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class Month(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class DayOfMonth(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class WeekOfYear(child: Expression) extends UnaryExpression with ImplicitCastInputTypes
    • case class DateFormatClass(left: Expression, right: Expression) extends BinaryExpression

@rxin
Copy link
Contributor Author

rxin commented Jul 19, 2015

I've merged this.

@asfgit asfgit closed this in 3427937 Jul 19, 2015
asfgit pushed a commit that referenced this pull request Jul 19, 2015
PR #7506 breaks master build because of compilation error. Note that #7506 itself looks good, but it seems that `git merge` did something stupid.

Author: Cheng Lian <lian@databricks.com>

Closes #7510 from liancheng/hotfix-for-pr-7506 and squashes the following commits:

7ea7e89 [Cheng Lian] Fixes compilation error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants